﻿using NHibernate;
using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
namespace DAO
{
    public class Manager
    {

        private static ISessionFactory _sessionFactory;

        /// <summary>
        /// 链接信息,初始化NH
        /// </summary>
        public static ISessionFactory SessionFactory
        {
            get
            {
                if (_sessionFactory == null)
                {
                    var path = HttpContext.Current.Server.MapPath("../bin/hibernate.cfg.xml");
                    var cfg = new NHibernate.Cfg.Configuration().Configure(path);
                    _sessionFactory = cfg.BuildSessionFactory();
                }
                return _sessionFactory;
            }
        }
    }
}
